<template>
  <el-container class="layout-page">
    <el-header>
      <div class="img">
        <img
          src="http://likede2-admin.itheima.net/img/logo.3673fab5.png"
          alt=""
        />
      </div>
      <div>
        <div class="user">
          <el-avatar
            src="https://img1.baidu.com/it/u=2380632617,3682105739&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1668963600&t=c1a5c61df561c8a1d5e1c89620c696eb"
          ></el-avatar>
          <el-link :underline="false">admin</el-link>
          <div class="logout">
            <el-popconfirm
              title="您缺人退出帝可得平台"
              @confirm="handleConfirm"
            >
              <template #reference>
                <i title="logout" class="el-icon-switch-button"></i>
              </template>
            </el-popconfirm>
          </div>
        </div>
      </div>
    </el-header>
    <el-container>
      <el-aside width="200px">
        <el-menu
          class="el-menu-vertical-demo"
          router
          :default-active="$route.path"
          background-color="#fff"
          text-color="#333"
          active-text-color="rgb(95, 132, 255)"
          @open="handleOpen"
          @close="handleClose"
        >
          <!-- 侧边 帝可得首页项目s -->
          <el-menu-item index="/dashboard">
            <i class="el-icon-house"></i>
            <span>帝可得</span>
          </el-menu-item>
          <!-- 侧边工单管理项目 -->
          <el-submenu index="/article">
            <template slot="title">
              <i class="el-icon-date"></i>
              <span>工单管理</span>
            </template>
            <el-menu-item-group>
              <!-- <template slot="title">分组一</template> -->
              <el-menu-item index="/article">运营工单</el-menu-item>
              <el-menu-item index="article1">运维工单</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <!-- 侧边点位管理项目 -->
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-map-location"></i>
              <span>点位管理</span>
            </template>
            <el-menu-item-group>
              <!-- <template slot="title">分组一</template> -->
              <el-menu-item index="/pointmanagement">区域管理</el-menu-item>
                <el-menu-item index="/pointmanagement2">点位管理</el-menu-item>
                   <el-menu-item index="/pointmanagement3">合作商管理</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <!-- 侧边设备管理项目 -->
          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-mobile"></i>
              <span>设备管理</span>
            </template>
            <el-menu-item-group>
              <!-- <template slot="title">分组一</template> -->
              <el-menu-item index="/fixingFm">设备管理</el-menu-item>
              <el-menu-item index="/fixingstate">设备状态</el-menu-item>
              <el-menu-item index="/fixingtype">设备类型管理</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <!-- 侧边人员管理项目 -->
          <el-submenu index="3">
            <template slot="title">
              <i class="el-icon-user"></i>
              <span>人员列表</span>
            </template>
            <el-menu-item-group>
              <!-- <template slot="title">分组一</template> -->
          <el-menu-item index="personnelManagement">人员列表</el-menu-item>
              <el-menu-item index="/usercount">人效统计</el-menu-item>
            <el-menu-item index="renyuan">工作量列表</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <!-- 侧边商品管理项目 -->
          <el-submenu index="4">
            <template slot="title">
              <i class="el-icon-shopping-cart-1"></i>
              <span>商品管理</span>
            </template>
            <el-menu-item-group>
              <!-- <template slot="title">分组一</template> -->
                <el-menu-item index="/goodstype">商品类型</el-menu-item>
              <el-menu-item index="/goodsmanage">商品管理</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <!-- 侧边 策略管理项目s -->
         <el-menu-item index="/strategy">
            <i class="el-icon-postcard"></i>
            <span>策略管理</span>
          </el-menu-item>
             <!-- 侧边 订单管理项目s -->
           <el-menu-item index="/order">
            <i class="el-icon-document-checked"></i>
            <span>订单管理</span>
          </el-menu-item>
          <!-- 侧边 管理项目s -->
           <el-menu-item index="/ReconciliationStatistics">
           <i class="el-icon-coin"></i>
            <span>对账统计</span>

          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  name: 'LayoutIndex',
  data () {
    return {
      username: '',
      avatar: ''
    }
  },
  async created () {
    // const res = await getUser()
    // console.log(res)
    // this.username = res.data.name
    // this.avatar = res.data.avatar
  },
  methods: {
    handleOpen (key, keyPath) {
      console.log(key, keyPath)
    },
    handleClose (key, keyPath) {
      console.log(key, keyPath)
    },
    handleConfirm () {
      this.$store.commit('user/logout')
      this.$router.push('/login')
    }
  }
}
</script>

<style lang="scss" scoped>
.layout-page {
  height: 100vh;
  .el-aside {
    background: #f8fafd;
    .logo {
      color: #fff;
      font-size: 20px;
      height: 60px;
      line-height: 60px;
      text-align: center;
    }
    .el-menu {
      border-right: none;
      margin-top: 20px;
      background-color: #fff;
      &-item {
        background-color: transparent !important;
        // > span,
        // i {
        //   // padding-left: 5px;
        // }
      }
    }
  }
  .el-header {
    box-shadow: 0px 0px 35px 0px rgba(154, 161, 171, 0.15);
    background-image: url();
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 999;
    .img {
      display: flex;
      height: 35px;
      // width: 120px;
      // text-align: right;
      // margin-right: 1200px;

      // align-items: center;
      // border: 1px solid #f1f3fa;
    }
    }
    .user {
      // width: 300px;
      display: flex;
      align-items: center;
      // background: #fafbfd;
      height: 60px;
      // border: 1px solid #f1f3fa;
      padding: 0 15px;
      .el-avatar {
        margin-right: 15px;
      }
    .logout {
      font-size: 20px;
      color: #999;
      cursor: pointer;
      padding: 0 15px;
    }
  }
  .el-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #aaa;
    border-top: 1px solid rgba(152, 166, 173, 0.2);
    font-size: 14px;
  }
}
</style>
